<!--
 * @Author: @yzcheng
 * @Date: 2021-04-13 18:24:29
 * @Version: 1.0
 * @LastEditors: @yzcheng
 * @Description: 
 * @LastEditTime: 2021-06-23 17:42:25
-->
<template>
  <el-dialog
    title="选择抄送人"
    :model-value="dialogUser"
    width="850px"
    @close="onClose"
    append-to-body
    destroy-on-close
  >
    <c-general-copies :radio="radio" />
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="submitCopiesData">确 定</el-button>
        <el-button @click="onClose">取 消</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script>
import GeneralCopies from './GeneralCopies.vue'

export default {
  name: 'UserCopiesDialog',
  components: {
    'c-general-copies': GeneralCopies,
  },
  provide() {
    return {
      getCopiesData: this.getCopiesData,
    }
  },
  emits: ['update:dialogUser'],
  props: {
    dialogUser: Boolean,
    radio: Boolean,
    getUserInfo: {
      type: Function,
    },
  },
  data() {
    return {
      userInfo: [],
      copiesData: [],
      visible: false,
    }
  },
  methods: {
    onClose() {
      this.copiesData = []
      this.userInfo = []
      this.$emit('update:dialogUser', false)
    },
    getCopiesData(copiesData, userInfo) {
      this.userInfo = userInfo
      this.copiesData = copiesData
    },
    submitCopiesData() {
      this.getUserInfo(this.copiesData, this.userInfo)
      this.$emit('update:dialogUser', false)
    },
  },
}
</script>

<style scoped></style>
